package com.bnz.serviceImpl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bnz.User;
import com.bnz.mapper.UserMapper;
import com.bnz.service.UserService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service // 注入到spring容器中
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {

    // 2、添加数据
    @Override
    public void add(User user) {
        getBaseMapper().insert(user);
    }

    // 2、查找全部数据
    @Override
    public List<User> findAll() {
        List<User> userList = getBaseMapper().selectList(null);// 没有条件，查询所有数据
        return userList;
    }
}
